<html>
<head><meta charset="utf-8"><title>Nightly features in macros · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html">Nightly features in macros</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="179918212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/179918212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#179918212">(Nov 05 2019 at 10:22)</a>:</h4>
<p>Is there any way to use nightly features in macros without making the users add feature flags to their crate? libstd has <code>allow_internal_unstable</code> for that, but is that intended to also work for user crates?<br>
See <a href="https://github.com/Gilnaa/memoffset/pull/31" target="_blank" title="https://github.com/Gilnaa/memoffset/pull/31">https://github.com/Gilnaa/memoffset/pull/31</a></p>



<a name="179918734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/179918734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#179918734">(Nov 05 2019 at 10:29)</a>:</h4>
<p>yea, you should be able to add feature flags to your crate to be able to add <code>allow_internal_unstable</code> to your macro. Users of your macro will then not need the feature gates</p>



<a name="179919026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/179919026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#179919026">(Nov 05 2019 at 10:32)</a>:</h4>
<p>hmm... can't get it to work though: <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=53f7565667c2d5d82923915a969f6aa6" target="_blank" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=53f7565667c2d5d82923915a969f6aa6">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=53f7565667c2d5d82923915a969f6aa6</a></p>



<a name="179919032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/179919032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#179919032">(Nov 05 2019 at 10:32)</a>:</h4>
<p>maybe it only works cross crate?</p>



<a name="179928049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/179928049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#179928049">(Nov 05 2019 at 12:46)</a>:</h4>
<p>it fails for doctests in the PR mentioned above</p>



<a name="179928050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/179928050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#179928050">(Nov 05 2019 at 12:46)</a>:</h4>
<p>that's cross-crate</p>



<a name="179928052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/179928052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#179928052">(Nov 05 2019 at 12:46)</a>:</h4>
<p>I think it might only work for libstd?</p>



<a name="179928940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/179928940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#179928940">(Nov 05 2019 at 12:59)</a>:</h4>
<p>I think it's just const support that doesn't work with <code>allow_internal_unstable</code>.</p>



<a name="179930392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/179930392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#179930392">(Nov 05 2019 at 13:18)</a>:</h4>
<p>(deleted)</p>



<a name="180044089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/180044089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#180044089">(Nov 06 2019 at 15:37)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> is there something const needs to do for that? <span class="user-mention" data-user-id="124288">@oli</span> ?</p>



<a name="180044221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/180044221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#180044221">(Nov 06 2019 at 15:38)</a>:</h4>
<p>heh</p>



<a name="180044242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/180044242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#180044242">(Nov 06 2019 at 15:38)</a>:</h4>
<p>I thought you were talking about macros?</p>



<a name="180044261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/180044261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#180044261">(Nov 06 2019 at 15:39)</a>:</h4>
<p>macros generating consts</p>



<a name="180044282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/180044282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#180044282">(Nov 06 2019 at 15:39)</a>:</h4>
<p>See <a href="https://github.com/Gilnaa/memoffset/pull/31" target="_blank" title="https://github.com/Gilnaa/memoffset/pull/31">https://github.com/Gilnaa/memoffset/pull/31</a></p>



<a name="180044673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/180044673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#180044673">(Nov 06 2019 at 15:43)</a>:</h4>
<p>yea, idk why that isn't working</p>



<a name="180044690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/180044690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#180044690">(Nov 06 2019 at 15:43)</a>:</h4>
<p>the spans should still know about the macro expansion</p>



<a name="180044698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Nightly%20features%20in%20macros/near/180044698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Nightly.20features.20in.20macros.html#180044698">(Nov 06 2019 at 15:43)</a>:</h4>
<p>and thus about the allow_internal_unstable</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>